package net.xiaohanlin.smartmetric.config;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class MetricRegistryConfiguration {

	private String name;
	private String metricPrefix;
	private String metricSuffix;

	private Map<String, MetricClassConfiguration> metricClassConfigurations = new HashMap<>();

	public String getName() {
		return name;
	}

	void setName(String name) {
		this.name = name;
	}

	public String getMetricPrefix() {
		return metricPrefix;
	}

	public String getMetricSuffix() {
		return metricSuffix;
	}

	public Map<String, MetricClassConfiguration> getMetricClassConfigs() {
		return Collections.unmodifiableMap(metricClassConfigurations);
	}

	MetricRegistryConfiguration(String name, String metricPrefix, String metricSuffix) {
		this.name = name;
		this.metricPrefix = metricPrefix;
		this.metricSuffix = metricSuffix;
	}

	void addMetricClassConfiguration(MetricClassConfiguration mcc) {
		this.metricClassConfigurations.put(mcc.getCls(), mcc);
	}

	public static class MetricClassConfiguration {

		public String getCls() {
			return cls;
		}

		public String getPrefix() {
			return prefix;
		}

		public String getSuffix() {
			return suffix;
		}

		String cls;
		String prefix;
		String suffix;

		MetricClassConfiguration(String cls, String prefix, String suffix) {
			this.cls = cls;
			this.prefix = prefix;
			this.suffix = suffix;
		}
	}


}
